<template>
	<view class="fxDetails">
		<view class="details-box" v-if="fxDetails">
			<view class="fx-title">
				{{fxDetails.title}}
			</view>
			<view class="fx-goods" @click="GoGoodDetail">
				<view class="goods-left">
					<img :src="fxDetails.showGoodsImg" alt="" srcset="">
				</view>
				<view class="goods-right">
					<view class="goods-title">
						{{fxDetails.goodDetails.title}}
					</view>
					<view class="goods-location">
						{{fxDetails.goodDetails.location}}
					</view>
				</view>
			</view>
			<view class="fx-content">
				{{fxDetails.content}}
			</view>
			<view class="fx-images">
				<img v-for="(item,index) in ImageList" :src="item" :key="index" alt="" srcset="">
			</view>
			<view class="fx-time">
				分享时间：{{fxDetails.createTime}}
			</view>
		</view>
	</view>
</template>

<script>
	import http from "../../static/http.js"
	export default{
		name:"",
		data(){
			return{
				rowDetailsId:"",
				fxDetails:"",
				ImageList:[]
			}
		},
		onLoad(params) {
			this.rowDetailsId = params.id
		},
		created() {
			this.getDetails()
		},
		methods:{
			getDetails(){
				http.httpRequest("/article/getDetail?id="+this.rowDetailsId,``,"GET").then(res=>{
					res.data.showGoodsImg = http.BASE_URL + res.data.goodDetails.imageList[0].url
					JSON.parse(res.data.imageList).forEach(val=>{
						this.ImageList.push( http.BASE_URL + val.url )
					})
					this.fxDetails = res.data
				})
			},
			GoGoodDetail(){
				uni.navigateTo({
					url:"/pages/fx/goods?id="+ this.fxDetails.goodDetails.id,
				})
			}
		}
	}
</script>

<style lang="less">
	.fxDetails{
		width: 100%;
		height: 100%;
		background-color: #f0f0f5;
		.details-box{
			width: 98%;
			height: 100%;
			margin: 0 auto;
			background-color: #fff;
			.fx-title{
				width: 100%;
				font-size: 35rpx;
				font-weight: 600;
				padding-top: 10rpx;
			}
			.fx-goods{
				width: 100%;
				height: 120rpx;
				background-color: #f0f0f7;
				display: flex;
				align-items: center;
				.goods-left{
					margin-left: 10rpx;
					img{
						width: 100rpx;
						height: 100rpx;
					}
				}
				.goods-right{
					margin-left: 10rpx;
					width: calc(100% - 120rpx);
					height: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					.goods-title{
						width: 100%;
						height: 60%;
						font-size: 40rpx;
						font-weight: 600;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						margin-top: 5rpx;
					}
					.goods-location{
						width: 100%;
						height: 40%;
						font-size: 28rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
			}
			.fx-content{
				width: 100%;
				font-size: 28rpx;
				text-indent: 2rem;
				padding-top: 10rpx;
			}
			.fx-images{
				width: 100%;
				height: auto;
				img{
					width: 100%;
					height: 300rpx;
					object-fit: contain;
					margin-top: 20rpx;
				}
			}
			.fx-time{
				padding-bottom: 10rpx;
			}
		}
		
	}
</style>